import Mock from 'mockjs'

const {mock} = Mock; // Mock函数

// 使用拦截规则拦截命中的请求
// mock( url, post/get, 返回的数据/函数（有return值）);
mock("/api/users", "get", {
        code: 200,
        data: {
            total: 11,
            list: Array.from({length: 11}, () => ({
                id: Mock.Random.id(),
                account: Mock.Random.cname(),
                status: Mock.Random.pick(['1', '0']),
                name: Mock.Random.cname(),
                email: Mock.Random.email(),
                createdTime: Mock.Random.datetime(),
                createdBy: Mock.Random.cname(),
                updatedTime: Mock.Random.datetime(),
                updatedBy: Mock.Random.cname(),
                age: Mock.Random.integer(20, 50),
                gender: Mock.Random.pick(['男', '女'])
            }))
        }
    }
);
